const http = require("http");
const fs = require("fs");
const url = require("url");
const server =http.createServer((req,res)=>{
    res.setHeader("content-type", "text/html;charset=utf-8");

    let urlobj=url.parse(req.url,true)
    let pathname =urlobj.pathname;

if (pathname == "/index") {
        let data = fs.readFileSync("./views/index.html");
        res.write(data)
    } else if (pathname == "/product") {
        let data = fs.readFileSync("./views/product.html");
        res.write(data)
    } else if (pathname == "/users") {
        let data = fs.readFileSync("./views/users.html");
        res.write(data);
    }

    res.end()

})

server.listen(8989)